Skip to content

Conversation

fractalwrench
Copy link
Member

Goal

This changeset demonstrates how to use opentelemetry-kotlin to capture a span and a log. This isn't meant to be merged - it's meant to start a discussion about how opentelemetry-kotlin could be used in opentelemetry-android, and make it easier for folks to play around with the API for themselves if they wish.

I've converted the crash instrumentation to capture a log using the Kotlin API (see CrashReporter). The slow rendering instrumentation captures a span (see SpanBasedJankReporter )

Compatibility

opentelemetry-kotlin has been designed so that it's easy to dip toes into the water to try things out. The Java API's OpenTelemetry symbol can be converted to the Kotlin API by calling toOtelKotlinApi() - under the hood this just decorates the Java implementation with a Kotlin API. It's also possible to access the underlying implementation via toOtelJavaApi(), and there are various hooks to convert between objects.

opentelemetry-kotlin has 2 modes: it can decorate the opentelemetry-java SDK, or use the opentelemetry-kotlin implementation. In the current configuration this decorates the opentelemetry-java implementation.

In future if opentelemetry-kotlin was the only API used in opentelemetry-android, it would be possible to switch over to the Kotlin implementation as both use the same API.

Copy link

codecov bot commented Sep 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.27%. Comparing base (8e97eb9) to head (dbc1dd3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1237      +/-   ##
==========================================
- Coverage   64.29%   64.27%   -0.03%     
==========================================
  Files         142      142              
  Lines        3011     3009       -2     
  Branches      296      297       +1     
==========================================
- Hits         1936     1934       -2     
  Misses        998      998              
  Partials       77       77              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant